import Vue from "vue";
import Router from "vue-router";
import Home from "./views/Home.vue";
import Banner from "./views/banner";

import CallApp from "./views/CallThirdApp";

Vue.use(Router);

export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/",
      redirect: "/home"
    },
    {
      path: "/home",
      name: "home",
      component: Home,
      children: [
        {
          path: "",
          redirect: "/index"
        },
        {
          path: "/index",
          name: "index",
          component: Banner,
          meta: {
            title: "首页"
          }
        },
        {
          path: "/credit",
          name: "credit",
          // route level code-splitting
          // this generates a separate chunk (about.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () =>
            import(/* webpackChunkName: "about" */ "./views/creditCard.vue"),
          meta: {
            title: "卡片自选"
          }
        },
        {
          path: "/selectCard",
          name: "selectCard",
          component: () =>
            import(/* webpackChunkName: "about" */ "./views/selectCard.vue"),
          meta: {
            title: "卡类型选择"
          }
        },
        /**
         * 在线申请信用卡
         */
        {
          path: "/onlineApply",
          name: "onlineApply",
          component: () => import("./views/online/OnlineApply.vue"),
          meta: {
            title: "上海银行信用卡在线申请"
          }
        },
        /**
         * 在线申请信用卡成功页
         */
        {
          path: "/onlineApplySuccess",
          name: "onlineApplySuccess",
          component: () => import("./views/online/OnlineApplySuccess.vue"),
          meta: {
            title: "申请成功"
          }
        },
        /*理财详情页*/
        {
          path: "/productDetail",
          name: "productDetail",
          component: () => import("./views/productDetail.vue"),
          meta: {
            title: "理财详情"
          }
        },
        {
          path: "/call-app",
          component: CallApp
        }
      ]
    }
  ]
});
